var request_headers = {
    "CAS_TOKEN": getToken()
};

// 车间切换
function getDeptChange(deptCode, sceneType) {
    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_ZZ_CJ_TAB",
            "deptCode": deptCode,
            "sceneType": sceneType,
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_ZZ_CJ_TAB != null) {
                deptChange(res.HT_ZZ_CJ_TAB);
            }
        },
        error: function (error) {
        }
    });
}

// 车间-返回按钮
function getWorkShopBackButton(deptCode, sceneType) {

    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_CJ_BUTTON_RETURN",
            "deptCode": deptCode,
            "sceneType": sceneType,
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_CJ_BUTTON_RETURN != null) {
                workShopBackButton(res.HT_CJ_BUTTON_RETURN);
            }
        },
        error: function (error) {
        }
    });
}

// 报警灯 getWarningLights
function getWarningLights(workshopCode) {
    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_CJJM_EQSTATUS",
            "workshopCode": workshopCode
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_CJJM_EQSTATUS != null) {
                warningLights(res.HT_CJJM_EQSTATUS);
            }
        },
        error: function (error) {
        }
    });
}

// 车间报表
// 车间报表-机床状态信息
function getBedCodeStatus(workshopCode) {
    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_SC_CJ_REPORT_JCZTTJ",
            "workshopCode": workshopCode
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_SC_CJ_REPORT_JCZTTJ != null) {
                bedCodeStatus(res.HT_SC_CJ_REPORT_JCZTTJ);
            }
        },
        error: function (error) {
        }
    });
}


// 车间报表-生产指示看板
function getProductionIndexBoard(workshopCode) {

    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_SC_CJ_REPORT_SCZBKBTJ",
            "workshopCode": workshopCode
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_SC_CJ_REPORT_SCZBKBTJ != null) {
                productionIndexBoard(res.HT_SC_CJ_REPORT_SCZBKBTJ);
            }
        },
        error: function (error) {
        }
    });
}

// 车间报表-工序合格量
function getProcessQualifiedQuantity(workshopCode) {

    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_SC_CJ_REPORT_GXHGLTJ",
            "workshopCode": workshopCode
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_SC_CJ_REPORT_GXHGLTJ != null) {
                processQualified(res.HT_SC_CJ_REPORT_GXHGLTJ);
            }
        },
        error: function (error) {
        }
    });
}

// 车间报表---规格合格量
function getProductsQualifiedQuantity(workshopCode) {

    $.ajax({
        url: domain + '/HT_DATA_EIGHT.getGlobalStatistics.do',
        type: "POST",
        headers: request_headers,
        data: {
            "props": "HT_SC_CJ_REPORT_GGHGL",
            "workshopCode": workshopCode
        },
        async: true,
        contentType: 'application/x-www-form-urlencoded',
        success: function (res) {
            res = JSON.parse(res);
            if ('OK' === res._MSG_ && res.HT_SC_CJ_REPORT_GGHGL != null) {
                productsQualified(res.HT_SC_CJ_REPORT_GGHGL);
            }
        },
        error: function (error) {
        }
    });
}

